var 提示信息 = ["生活是没有一帆风顺的，遇到委屈就笑一笑。还有很多事情等着你去做。", "生活是没有一帆风顺的，遇到委屈就笑一笑。还有很多事情等着你去做。"];
var 村庄地图 = [
    [749050400, "转蛋抽奖"],
    [951000000, "怪物公园"],
    [910001000, "匠人街"],
    [680000000, "婚礼村"],
    [931000500, "抓豹子"],
    [867115950, "藏身处"],
    [910800200, "三维弹球"],
    [103041000, "废都塔"],
    [3000200, "可可岛"],
    [330000000, "神兽学院"],
    [800000000, "蘑菇神社"],
    [141000000, "列纳海峡"],
    [500000000, "水上市场"],
    [402000600, "贝尔达"],
    [221000000, "地球本部"],
    [1100000, "彩虹岛"],
    [130000000, "圣地"],
    [140000000, "里恩"],
    [310000000, "德尔斯坦"],
    [807000000, "本能寺"],
    [410000000, "狐狸村"],
    [866000000, "大树村"],
    [400000000, "万神殿"],
    [104000000, "明珠港"],
    [100000000, "射手村"],
    [101000000, "魔法密林"],
    [102000000, "勇士部落"],
    [103000000, "废弃都市"],
    [120000000, "诺特勒斯"],
    [105000000, "林中之城"],
    [402000500, "阿叙隆"],
    [402000521, "水晶学院"],
    [402000000, "暴徒村"],
    [867118200, "埃尔露娜"],
    [867115900, "阿特利埃"],
    [101050000, "埃欧雷"],
    [101071300, "妖精学院"],
    [120040000, "金海滩"],
    [106030100, "蘑菇城"],
    [200000000, "天空之城"],
    [211000000, "冰封雪域"],
    [211060000, "狮子王城"],
    [230000000, "水下世界"],
    [224000000, "童话村"],
    [220000000, "玩具城"],
    [220050300, "时间通道"],
    [222100000, "梦幻公园"],
    [300000000, "艾琳森林"],
    [251000000, "百草堂"],
    [250000000, "武陵镇"],
    [252000000, "黄金寺院"],
    [260000000, "阿里安特"],
    [261000000, "玛加提亚"],
    [241000000, "克里蒂亚"],
    [240000000, "神木村"],
    [240090000, "勘探本部"],
    [401000000, "赫里希安"],
    [701100000, "上海豫园"],
    [701210000, "嵩山镇"],
    [701220000, "大雄宝殿"],
    [600000000, "新叶城"],
    [610020005, "绯红之地"],
    [865010200, "渔村贝里"],
    [865000000, "凯梅尔兹"],
    [270000100, "时间神殿"],
    [273000000, "黄昏部落"],
    [273050000, "避难所"],
    [271010000, "射手遗址"],
    [703000000, "新叶遗址"],
    [410000100, "狐狸谷"],
    [860000000, "蔚蓝道路"],
    [310070000, "机械坟墓"],
    [105300000, "废弃营地"],
    [450001000, "无名村"],
    [450002000, "啾啾岛"],
    [450003330, "拉克兰"],
    [450005000, "精灵之乡"],
    [450006130, "莫拉斯"],
    [450007000, "太初之海"],
    [450009050, "前哨基地"],
    [450009100, "月桥"],
    [450011120, "痛苦迷宫"],
    [450012000, "黎曼"]
];
var 练级地图 = [
    [140020200, "[简单]　　冰雪岛　「 推荐Lv：10 ≈ 15   」"],
    [410000040, "[简单]　　狐狸村　「 推荐Lv：20 ≈ 30   」"],
    [402000618, "[简单]　　贝尔达　「 推荐Lv：20 ≈ 30   」"],
    [120041600, "[简单]　　金海滩　「 推荐Lv：35 ≈ 45   」"],
    [103030300, "[简单]　　沼泽地　「 推荐Lv：48 ≈ 57   」"],
    [103020410, "[简单]　 废都地铁 「 推荐Lv：48 ≈ 57   」"],
    [106030502, "[简单]　　蘑菇城　「 推荐Lv：60 ≈ 68   」"],
    [105010000, "[简单]　 寂静湿地 「 推荐Lv：60 ≈ 68   」"],
    [105030500, "[简单]　　蚂蚁洞　「 推荐Lv：70 ≈ 75   」"],
    [211050000, "[中等]　 冰峰雪域 「 推荐Lv：78 ≈ 85   」"],
    [230010300, "[中等]　 海螺山丘 「 推荐Lv：78 ≈ 85   」"],
    [260020620, "[中等]　 沙翁小镇 「 推荐Lv：88 ≈ 95   」"],
    [221022700, "[中等]　 玩具塔95 「 推荐Lv：100 ≈ 110 」"],
    [300020200, "[中等]　 原始森林 「 推荐Lv：100 ≈ 110 」"],
    [240020100, "[中等]　 火焰战场 「 推荐Lv：110 ≈ 120 」"],
    [211041400, "[中等]　 死亡之林 「 推荐Lv：120 ≈ 135 」"],
    [220060300, "[中等]　 扭曲时间 「 推荐Lv：120 ≈ 135 」"],
    [240040600, "[高级]　 主巢山峰 「 推荐Lv：140 ≈ 155 」"],
    [701210110, "[高级]　  少林寺  「 推荐Lv：140 ≈ 155 」"],
    [270030500, "[高级]　 忘却之路 「 推荐Lv：155 ≈ 165 」"],
    [240093100, "[高级]　 岩壁巨人 「 推荐Lv：155 ≈ 165 」"],
    [271030100, "[高级]　 骑士要塞 「 推荐Lv：165 ≈ 185 」"],
    [221030400, "[高级]　 地球本部 「 推荐Lv：165 ≈ 185 」"],
    [241000226, "[高级]　 王国道路 「 推荐Lv：185 ≈ 192 」"],
    [273040300, "[高级]　 黄昏部落 「 推荐Lv：187 ≈ 195 」"],
    [410000123, "[高级]　  狐狸谷  「 推荐Lv：195 ≈ 203 」"],
    [310070100, "[高级]　  避风港  「 推荐Lv：195 ≈ 203 」"],
    [240020300, "[星力] 冰冷战场 「 推荐Lv：160 ≈ 205 」"],
    [220060301, "[星力] 怪异时间 「 推荐Lv：160 ≈ 205 」"],
    [240040512, "[星力] 龙之巢穴 「 推荐Lv：160 ≈ 205 」"],
    [270030630, "[星力] 忘却之路 「 推荐Lv：160 ≈ 205 」"],
    [105300203, "[超级] 堕落世界树 「 推荐Lv：205 ≈ 215 」"],
    [310070430, "[超级]   黑色天堂 「 推荐Lv：205 ≈ 215 」"]
];
var 副本地图 = [
    [105100100, "蝙蝠怪"],
    [211042300, "扎昆"],
    [240050400, "暗黑龙王"],
    [270040000, "品克缤"],
    [211070000, "班雷昂"],
    [300030300, "艾菲尼娅"],
    [272020110, "阿卡伊勒"],
    [222130200, "心疤狮王"],
    [262030000, "希拉"],
    [211041700, "森兰丸"],
    [271040000, "希纳斯"],
    [220080000, "闹钟王"],
    [105200000, "鲁塔比斯"],
    [970072200, "乌鲁斯"],
    [401060000, "麦格纳斯"],
    [350060300, "斯乌"],
    [105300303, "戴米安"],
    [863000100, "贝勒德"],
    [450012200, "敦凯尔"],
    [450009300, "至暗魔晶"],
    [450011320, "觉醒希拉"],
    [450004000, "路西德"],
    [450007240, "威尔"],
    [450012500, "黑魔法师"]
];
var 组队地图 = [
    [910000000, "自由市场"],
    [910002000, "组队任务入场"]
];
var 跳跳地图 = [
    [100000202, "射手村-宠物公园"],
    [220000006, "玩具城-宠物公园"],
    [280020000, "冰峰雪域-扎二"],
    [109040001, "冒险岛活动"],
    [922000000, "玩具城-骨干工程"],
    [910130000, "魔法密林-忍苦树林"],
    [910130100, "魔法密林-忍苦树林2"],
    [910530000, "林中之城-韧性之林"],
    [910530100, "林中之城-韧性之林2"],
    [910530200, "林中之城-韧性之林3"],
    [910360000, "废弃都市-地铁B1"],
    [910360100, "废弃都市-地铁B2"],
    [910360200, "废弃都市-地铁B3"]
];

function start() {
    action(1, 0, 0)
}

function action(g, l, q) {
    var m = cm.getConstantScriptContent("菜单_NPC立绘");
    var h = Math.floor(Math.random() * m.length);
    var c = m[h][0];
    var k = randomNum(0, m[h][1]);
    if (cm.getzhizunvip() != 2) {
        cm.dispose();
        cm.playerMessage(1, "该菜单是至尊版专享。");
        return
    }
    if (g == 0 && status == 0) {
        cm.dispose();
        cm.openNpc(0, "拍卖菜单_至尊版");
        return
    }
    if (g <= 0 && status > 0) {
        cm.dispose();
        cm.openNpc(0, "万能传送_至尊版");
        return
    }
    status++;
    selectionLog[status] = q;
    var f = -1;
    if (status === f++) {
        cm.dispose()
    } else {
        if (status === f++) {
            var r = "#face" + k + "##fn方正粗黑宋简体##fs17##r";
            r += "     欢迎使用 " + cm.getServerName() + " 万能传送#fs15#\r\n";
            r += "      服务器时间：#b" + year + "年" + month + "月" + day + "日 " + hour + "点" + min + "分" + sec + "秒 #r星期" + weekName[weekday] + "#k\r\n#b";
            r += "  #fs17##g#L10#点我全地图查询传送#l#b#fs15#\r\n\r\n";
            r += "  #L0#村庄传送#l  #L1#练级传送#l  #L2#副本传送#l\r\n";
            r += "  #L3#组队任务#l  #L4#跳跳任务#l\r\n";
            cm.askMenu_Bottom(r, 204, c)
        } else {
            if (status === f++) {
                var r = " #face" + k + "##fn方正粗黑宋简体##fs17##r你想要前往哪里呢？\r\n  #k#fs13#(未探索地区先通过任务进入，否则剧情错乱后果自负。)#b\r\n#fs14#";
                if (q == 10) {
                    cm.askText_Bottom("#face" + k + "##fn方正粗黑宋简体# 请输入目的地ID或名称，支持模糊查询。#fs15#\r\n  #b如：天空之城、射手、100000000、3000000", c);
                    MapType = 10
                } else {
                    if (q == 0) {
                        for (var f = 0; f < 村庄地图.length; f++) {
                            r += " #L" + (f) + "#" + 村庄地图[f][1] + "";
                            var p = 4;
                            var s = 村庄地图[f][1].length;
                            var b = s;
                            for (var j = 0; j < s; j++) {
                                if (村庄地图[f][1].charCodeAt(j) < 0 || 村庄地图[f][1].charCodeAt(j) > 255) {
                                    b++
                                }
                            }
                            var e = p - (b / 2);
                            for (var a = 0; a < e; a++) {
                                r += "　"
                            }
                            r += "#l";
                            if (f != 0 && (f + 1) % 6 == 0) {
                                r += "\r\n"
                            }
                        }
                        MapType = 0;
                        cm.askMenu_Bottom(r, 204, c)
                    } else {
                        if (q == 1) {
                            for (var f = 0; f < 练级地图.length; f++) {
                                r += "#L" + f + "#   " + 练级地图[f][1] + "\r\n"
                            }
                            r += "#l";
                            MapType = 1;
                            cm.askMenu_Bottom(r, 204, c)
                        } else {
                            if (q == 2) {
                                for (var f = 0; f < 副本地图.length; f++) {
                                    r += " #L" + (f) + "#" + 副本地图[f][1] + " ";
                                    var p = 4;
                                    var s = 副本地图[f][1].length;
                                    var b = s;
                                    for (var j = 0; j < s; j++) {
                                        if (副本地图[f][1].charCodeAt(j) < 0 || 副本地图[f][1].charCodeAt(j) > 255) {
                                            b++
                                        }
                                    }
                                    var e = p - (b / 2);
                                    for (var a = 0; a < e; a++) {
                                        r += "　"
                                    }
                                    r += "#l";
                                    if (f != 0 && (f + 1) % 6 == 0) {
                                        r += "\r\n"
                                    }
                                }
                                MapType = 2;
                                cm.askMenu_Bottom(r, 204, c)
                            } else {
                                if (q == 3) {
                                    for (var f = 0; f < 组队地图.length; f++) {
                                        r += "#L" + f + "#" + 组队地图[f][1] + " \r\n"
                                    }
                                    r += "#l";
                                    MapType = 3;
                                    cm.askMenu_Bottom(r, 204, c)
                                } else {
                                    if (q == 4) {
                                        for (var f = 0; f < 跳跳地图.length; f++) {
                                            r += "#L" + f + "#" + 跳跳地图[f][1] + " \r\n"
                                        }
                                        r += "#l";
                                        MapType = 4;
                                        cm.askMenu_Bottom(r, 204, c)
                                    }
                                }
                            }
                        }
                    }
                }
            } else {
                if (status === f++) {
                    selects = q;
                    if (cm.getMeso() < 80000) {
                        cm.getTopMsgFont("需要80,000金币才行。", 3, 20, 4, 0, 0);
                        cm.dispose();
                        return
                    } else {
                        cm.gainMeso(-80000)
                    }
                    switch (MapType) {
                        case 10:
                            if (cm.getText() == "") {
                                cm.playerMessage(-1, "请输入关键字！");
                                cm.effect_NormalSpeechBalloon("请输入关键字", 1, 0, 0, 3000, 0, 0);
                                cm.dispose();
                                return
                            }
                            list = cm.getSearchData(3, cm.getText());
                            if (list == null) {
                                cm.getTopMsgFont("搜索不到信息", 3, 20, 4, 0, 0);
                                cm.dispose();
                                return
                            }
                            if (!cm.foundData(3, cm.getText())) {
                                cm.dispose();
                                return
                            }
                            cm.askMenu_Bottom("#face" + k + "#" + cm.searchData(3, cm.getText()), 204, c);
                            MapType2 = 10;
                            break;
                        case 0:
                            cm.warp(村庄地图[selects][0], 0, false);
                            cm.addPopupSay(c, 3000, "#face" + k + "#[当前位置]：#m" + cm.getMapId() + "#");
                            cm.effect_NormalSpeechBalloon("#e[当前位置]：#n#m" + cm.getMapId() + "#", 1, 0, 0, 4000, 0, 0);
                            cm.dispose();
                            break;
                        case 1:
                            cm.warp(练级地图[selects][0]);
                            cm.addPopupSay(c, 3000, "#face" + k + "#[当前位置]：#m" + cm.getMapId() + "#");
                            cm.effect_NormalSpeechBalloon("#e[当前位置]：#n#m" + cm.getMapId() + "#", 1, 0, 0, 4000, 0, 0);
                            cm.dispose();
                            break;
                        case 2:
                            cm.warp(副本地图[selects][0], 0);
                            cm.addPopupSay(c, 3000, "#face" + k + "#[当前位置]：#m" + cm.getMapId() + "#");
                            cm.effect_NormalSpeechBalloon("#e[当前位置]：#n#m" + cm.getMapId() + "#", 1, 0, 0, 4000, 0, 0);
                            cm.dispose();
                            break;
                        case 3:
                            cm.warp(组队地图[selects][0], 0);
                            cm.addPopupSay(c, 3000, "#face" + k + "#[当前位置]：#m" + cm.getMapId() + "#");
                            cm.effect_NormalSpeechBalloon("#e[当前位置]：#n#m" + cm.getMapId() + "#", 1, 0, 0, 4000, 0, 0);
                            cm.dispose();
                            break;
                        case 4:
                            cm.warp(跳跳地图[selects][0]);
                            cm.addPopupSay(c, 3000, "#face" + k + "#[当前位置]：#m" + cm.getMapId() + "#");
                            cm.effect_NormalSpeechBalloon("#e[当前位置]：#n#m" + cm.getMapId() + "#", 1, 0, 0, 4000, 0, 0);
                            cm.dispose();
                            break
                    }
                } else {
                    if (status === f++) {
                        selects = q;
                        switch (MapType2) {
                            case 10:
                                cm.warp(selects, 0);
                                cm.addPopupSay(c, 3000, "#face" + k + "#[当前位置]：#m" + cm.getMapId() + "#");
                                cm.effect_NormalSpeechBalloon("#e[当前位置]：#n#m" + cm.getMapId() + "#", 1, 0, 0, 4000, 0, 0);
                                cm.dispose();
                                break
                        }
                    }
                }
            }
        }
    }
}
var status = -1;
var selectionLog = [];
var selects = 0;
var text;
var MapType;
var cal = java.util.Calendar.getInstance();
var year = cal.get(java.util.Calendar.YEAR);
var month = cal.get(java.util.Calendar.MONTH) + 1;
var day = cal.get(java.util.Calendar.DATE);
var hour = cal.get(java.util.Calendar.HOUR_OF_DAY);
var min = cal.get(java.util.Calendar.MINUTE);
var sec = cal.get(java.util.Calendar.SECOND);
var weekday = cal.get(java.util.Calendar.DAY_OF_WEEK) - 1;
var weekName = ["日", "一", "二", "三", "四", "五", "六"];

function 字符填充(c, g) {
    var b = c;
    var i = g.length;
    var h = i;
    for (var f = 0; f < i; f++) {
        if (g.charCodeAt(f) < 0 || g.charCodeAt(f) > 255) {
            h++
        }
    }
    var a = b - (h / 2);
    if (h > 0) {
        for (var e = 0; e < a; e++) {
            text += "　"
        }
    } else {
        text += "　"
    }
}

function randomNum(b, a) {
    switch (arguments.length) {
        case 1:
            return parseInt(Math.random() * b + 1, 10);
            break;
        case 2:
            return parseInt(Math.random() * (a - b + 1) + b, 10);
            break;
        default:
            return 0;
            break
    }
};